package SynchronizedStudy;


import java.text.SimpleDateFormat;
import java.util.Date;

class Number{
    public synchronized void a(){
        System.out.println("1");
    }

    public synchronized void b(){
        System.out.println("2");
    }
}
public class TestBlock {

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS");
    String date = sdf.format(new Date());
    long num = (long) (Math.random() * (999L - 100L)) + 100L;
    public static void main(String[] args) throws InterruptedException {
        int a = 1;
        Integer b = 1;
        System.out.println(a==b);
        Number n = new Number();
        Thread t1 = new Thread(()->{
            System.out.println("t1->begin!!!");
            n.a();
        });

        Thread t2 = new Thread(()->{
            System.out.println("t2->begin!!!");
            n.b();
        });
        t1.start();
        t2.start();
        t1.join();
        t2.join();
    }
}
